{% extends "oa/base.html" %}
{% load i18n static %}
{% block title %} SOP文件列表 {% endblock %}
{% block content %}
    <section class="panel">
        <div class="panel-body">
            <form method="get" action="{{ request.path }}" class="form-inline">
                <div class="form-group">
                    <label for="q">搜索:</label>
                    <input type="text" class="form-control" name="q" value="{{ request.GET.q }}" id="q">
                </div>
                <div class="form-group">
                    <label for="document_type">文件类型:</label>
                    <select name="document_type" id="document_type" class="form-control">
                        <option value="">-----</option>
                        {% for s in document_type %}
                        {% ifequal s.pk|escape request.GET.document_type %}
                        <option value="{{ s.pk }}" selected>{{ s.code }}-{{ s.name }}</option>
                        {% else %}
                        <option value="{{ s.pk }}">{{ s.code }}-{{ s.name }}</option>
                        {% endifequal %}
                        {% endfor %}
                    </select>
                </div>
                <div class="form-group">
                    <label for="department">部门名称:</label>
                    <select name="department" id="department" class="form-control">
                        <option value="">-----</option>
                        {% for s in department %}
                        {% ifequal s.pk|escape request.GET.department %}
                        <option value="{{ s.pk }}" selected>{{ s.code }}-{{ s.name }}</option>
                        {% else %}
                        <option value="{{ s.pk }}">{{ s.code }}-{{ s.name }}</option>
                        {% endifequal %}
                        {% endfor %}
                    </select>
                </div>
                <div class="form-group">
                    <label for="document_level">文件等级:</label>
                    <select name="document_level" id="document_level" class="form-control">
                        <option value="">-----</option>
                        {% for s in document_level %}
                        {% ifequal s.pk|escape request.GET.document_level %}
                        <option value="{{ s.pk }}" selected>{{ s.level_code }}</option>
                        {% else %}
                        <option value="{{ s.pk }}">{{ s.level_code }}</option>
                        {% endifequal %}
                        {% endfor %}
                    </select>
                </div>
                <button type="submit" class="btn btn-info">搜索</button>
            </form>
        </div>
    </section>
    <section class="panel">
        <div class="panel-body table-responsive">
            <table class="table table-striped table-bordered table-responsive">
                <thead>
                    <tr>
                        <th colspan="8">
                            <a href="/page/sop/sop_doc_all/" target="_blank"><h3>体系文件总览</h3></a>
                        </th>
                    </tr>
                    <tr>
                        <th>ID</th>
                        <th>文件编号</th>
                        <th>文件名称</th>
                        <th>文件类型</th>
                        <th>部门名称</th>
                        <th>版本</th>
                        <th>发布日期</th>
                        <th>文件</th>
                    </tr>
                </thead>
                <tbody>
                    {% for row in object_list %}
                    <tr>
                        <td>{{ row.pk }}</td>
                        <td><a target="_blank" href="/page/sop/sop_doc/{{ row.pk }}/">{{ row.code }}</a></td>
                        <td>{{ row.name }}</td>
                        <td>{{ row.document_type }}</td>
                        <td>{{ row.department }}</td>
                        <td>{{ row.version_code }}</td>
                        <td>{{ row.published_at }}</td>
                        <td>{{ row.file }}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            <div class="text-right">
                {% include 'pagination.html' %}
            </div>
        </div>
    </section>
{% endblock %}